package com.emmy.walnut.model;

import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.ForeignKey;
import android.arch.persistence.room.Index;
import android.arch.persistence.room.PrimaryKey;

/**
 * @ClassName Record
 * @Description TODO
 * @Author zhouxuan
 * @Date 2020/02/05 10:21
 * @Version 1.0
 */
@Entity(foreignKeys = {@ForeignKey(entity = User.class, parentColumns = "username", childColumns = "username"),
    @ForeignKey(entity = Label.class, parentColumns = "id", childColumns = "labelId")},
    indices = {@Index("username"), @Index("labelId")})
public class Record {
    @PrimaryKey(autoGenerate = true)
    long id;

    @ColumnInfo
    String username;

    @ColumnInfo
    int labelId;

    @ColumnInfo
    String labelName;

    @ColumnInfo
    long startTimestamp;

    @ColumnInfo
    long endTimestamp;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getLabelName() {
        return labelName;
    }

    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }


    public long getStartTimestamp() {
        return startTimestamp;
    }

    public void setStartTimestamp(long startTimestamp) {
        this.startTimestamp = startTimestamp;
    }

    public long getEndTimestamp() {
        return endTimestamp;
    }

    public void setEndTimestamp(long endTimestamp) {
        this.endTimestamp = endTimestamp;
    }

    public int getLabelId() {
        return labelId;
    }

    public void setLabelId(int labelId) {
        this.labelId = labelId;
    }

    public Record(String username, int labelId, String labelName, long startTimestamp, long endTimestamp) {
        this.username = username;
        this.labelId = labelId;
        this.labelName = labelName;
        this.startTimestamp = startTimestamp;
        this.endTimestamp = endTimestamp;
    }
}
